package com.superlight.designer.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.superlight.designer.comm.animation.MultiRequestBody;
import com.superlight.designer.entity.Plan;
import com.superlight.designer.entity.vo.PageVO;
import com.superlight.designer.entity.vo.PlanVO;
import com.superlight.designer.service.IPlanService;
import com.superlight.designer.wrapper.PageWrapper;
import com.superlight.designer.wrapper.PlanWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**方案控制器
 * @Classname PlanController
 * @Description TODO
 * @Date 2021/5/10 11:02
 * @Created by leishihua
 */
@Api(value = "方案控制器",description = "方案操作 API", position = 100, protocols = "http",tags = "方案控制器")
@RestController
@RequestMapping("plan")
public class PlanController {

    @Resource
    IPlanService planService;

    @ApiOperation(
            value = "方案列表"
    )
    @PostMapping("/queryList")
    @ResponseBody
    public IPage<PlanVO> queryPageList(
            @ApiParam(value = "page") @MultiRequestBody PageVO page,
            @ApiParam(value = "planVO") @MultiRequestBody(required = false) PlanVO planVO
    ){
        Page<Plan> page2 = PageWrapper.build().entityVO(page);
        return PlanWrapper.build().pageVO(planService.selectList(page2,planVO));
    }
}
